<?php
namespace app\controller;

class ApiBaseController
{
    public $noNeedLogin=[];

    protected function success($data=[],$message='success',$code=200){
        return $this->response($code,$message,$data);
    }

    protected function fail($code=500,$message='fald',$data=[]){
       return $this->response($code,$message,$data);
    }

    protected function response($code,$message,$data){
        return json([
            'code'=>$code,
            'message'=>$message,
            'data'=>$data,
            'timestamp'=>time()
        ]);
    }
}